#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from django.db import models


class Teacher(models.Model):
    id = models.IntegerField(primary_key=True)
    name = models.TextField(blank=True)  # This field type is a guess.

    class Meta:
        db_table = 'teacher'


# Create your models here.
class Student(models.Model):
    id = models.IntegerField(primary_key=True)
    name = models.TextField()  # This field type is a guess.
    age = models.IntegerField()
    inttime = models.DateTimeField()
    sex = models.TextField()  # This field type is a guess.
    teacher = models.ForeignKey(Teacher)

    class Meta:
        db_table = 'student'


class Group(models.Model):
    id = models.IntegerField(primary_key=True)
    name = models.CharField(max_length=50)
    members = models.ManyToManyField(Student, through="MemberShip")

    class Meta:
        db_table = 'group'


class MemberShip(models.Model):
    id = models.IntegerField(primary_key=True)
    group = models.ForeignKey(Group)
    student = models.ForeignKey(Student)

    class Meta:
        db_table = 'membership'
